//-------------------------------------------------------------------
//	Copyright (c) 2010-2014  Zhirnov Andrey
//	This file is part of the "UX Standard Lib" project.
//	See copyright notice in "UX_STL_Core.h".
//-------------------------------------------------------------------

#ifndef _UXS_PHYSICS_VALUE_VEC_H
#define _UXS_PHYSICS_VALUE_VEC_H

#pragma once

#include "PhysicsValue.h"

namespace UX_STL
{
namespace UXMath
{
	
	template <typename T, usize I>
	struct PhysicsValueVec;


#define I	1
#include "PhysicsValueVecI.h"
#undef	I


#define I	2
#include "PhysicsValueVecI.h"
#undef	I

	
#define I	3
#include "PhysicsValueVecI.h"
#undef	I


#define I	4
#include "PhysicsValueVecI.h"
#undef	I


	
	//
	// operator *
	//

	template <typename ValueType,
			  typename Dimensions,
			  typename ValueScale,
			  usize I
			 >
	inline PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I >
		operator * (const TVec<ValueType,I> &left, const PhysicsValue<ValueType, Dimensions, ValueScale> &right)
	{
		PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I >	ret;
		FOR( i, ret )	ret[i] = left[i] * right;
		return ret;
	}
	

	template <typename ValueType,
			  typename Dimensions,
			  typename ValueScale,
			  usize I
			 >
	inline PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I >
		operator * (const PhysicsValue<ValueType, Dimensions, ValueScale> &left, const TVec<ValueType,I> &right)
	{
		PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I >	ret;
		FOR( i, ret )	ret[i] = left * right[i];
		return ret;
	}
	


	//
	// operator /
	//

	template <typename ValueType,
			  typename Dimensions,
			  typename ValueScale,
			  usize I
			 >
	inline PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I >
		operator / (const TVec<ValueType,I> &left, const PhysicsValue<ValueType, Dimensions, ValueScale> &right)
	{
		PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I >	ret;
		FOR( i, ret )	ret[i] = left[i] / right;
		return ret;
	}
	

	template <typename ValueType,
			  typename Dimensions,
			  typename ValueScale,
			  usize I
			 >
	inline PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I >
		operator / (const PhysicsValue<ValueType, Dimensions, ValueScale> &left, const TVec<ValueType,I> &right)
	{
		PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I >	ret;
		FOR( i, ret )	ret[i] = left / right[i];
		return ret;
	}
	


	//
	// Equals
	//
	
	template <typename ValueType,
			  typename Dimensions,
			  typename ValueScale
			 >
	inline bool Equals (const PhysicsValue<ValueType, Dimensions, ValueScale>& a,
						const PhysicsValue<ValueType, Dimensions, ValueScale>& b)
	{
		return Equals( a.ref(), b.ref() );
	}

	
	template <typename ValueType,
			  typename Dimensions,
			  typename ValueScale,
			  usize I
			 >
	inline TVec<bool,I>  Equals (const PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I > &a,
								 const PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I > &b)
	{
		TVec<bool,I>	ret;
		FOR( i, ret )	ret[i] = Equals( a[i], b[i] );
		return ret;
	}

	
	template <typename ValueType,
			  typename Dimensions,
			  typename ValueScale
			 >
	inline bool Equals (const PhysicsValue<ValueType, Dimensions, ValueScale>& a,
						const PhysicsValue<ValueType, Dimensions, ValueScale>& b,
						/*Bits*/uint accuracy)
	{
		return Equals( a.ref(), b.ref(), accuracy );
	}

	
	template <typename ValueType,
			  typename Dimensions,
			  typename ValueScale,
			  usize I
			 >
	inline TVec<bool,I>  Equals (const PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I > &a,
								 const PhysicsValueVec< PhysicsValue<ValueType, Dimensions, ValueScale>, I > &b,
								 /*Bits*/uint accuracy)
	{
		TVec<bool,I>	ret;
		FOR( i, ret )	ret[i] = Equals( a[i], b[i], accuracy );
		return ret;
	}



}	// UXMath
}	// UX_STL

#endif	// _UXS_PHYSICS_VALUE_VEC_H
